package com.example.IOCtry;

import com.example.IOCtry.config.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class UserController {
@Autowired
private UserService userService;
//@Qualifier("userInfo2")
    @Resource(name="userInfo2")
@Autowired
private UserInfo userInfo;
//注意此时加完构造函数之后，还要把无参数的也写一遍，因为无参数的构造函数，有很多东西在用，所以一旦经过修改，就会让使用无参数的报错。

//public UserController(){
//}
//
//public  UserController(UserService userService){
//    this.userService=userService;
//}
//
//    public  UserController(UserInfo userInfo,UserService userService){
//        this.userService=userService;
//        this.userInfo=userInfo;
//    }
//   @Autowired
//    public  void setUserController(UserService userService){
//        this.userService=userService;
//    }
public void prin(){
    userService.doService();
    System.out.println(userInfo);
    System.out.println("春节快乐");
}
}
